<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>加油列表-增加</title>
	<link rel="stylesheet" type="text/css" href="../resource/css/base.css" />
	<script type="text/javascript" src="../resource/js/My97DatePicker/WdatePicker.js"></script>
	<s:actionmessage/>
	<script type="text/javascript">
		function doSumbit(){
			var form = document.forms[0];
			var orderId = document.getElementsByName("orderId")[0].value;
			var truckId = document.getElementsByName("truckId")[0].value;
			var driverId = document.getElementsByName("driverId")[0].value;
			if(orderId == ""){
				alert("请选择订单号.");
				return false;
			}
			if(driverId == ""){
				alert("请选择驾驶员.");
				return false;
			}
			if(truckId == ""){
				alert("请选择车牌号.");
				return false;
			}
			if(form.petrolType.value == ""){
				alert("请选择加油类型.");
				return false;
			}
			//正则表达式对象
			var pattern = /^[0-9]+(\.[0-9]{1,2})$/;
			if(form.petrolQuantity.value==""||!pattern.test(form.petrolQuantity.value)){
				alert("加油数数据格式错误，请重新输入.");
				return false;
			}
			if(form.unitPrice.value==""||!pattern.test(form.unitPrice.value)){
				alert("油单价数据格式错误，请重新输入.");
				return false;
			}
			if(form.totalCharge.value==""||!pattern.test(form.totalCharge.value)){
				alert("总金额数据格式错误，请重新输入.");
				return false;
			}
			form.action="add.action";
			form.submit();
		}
	</script>
</head>
<body  oncontextmenu="return false;" leftmargin="8" topmargin="8">
<div class="tip"><span>当前位置:</span>加油管理&nbsp;&gt;&nbsp;新增&nbsp;&gt;&nbsp;</div>
<s:form name="add" namespace="/costPetrol">
<table class="edittb" cellpadding="2" cellspacing="1">
	<tr bgcolor="#EEF4EA">
		<td height="35" colspan="4">&nbsp;加油信息&nbsp;</td>
	</tr>
	<tr>
		<td class="coln"><SPAN style="color: red">*</SPAN> 货运单号</td>
		<td width="35%" class="colv">
			<s:textfield name="orderId" readonly="true"/> <img src="../resource/image/menusearch.gif" style="cursor: pointer;">
		</td>
		<td class="coln"><SPAN style="color: red">*</SPAN> 车牌号</td>
		<td width="45%" class="colv">
			<s:select list="trucks" listKey="truckId" listValue="truckId" headerKey="" headerValue="-选择车牌号-"  name="truckId" cssStyle="width:80%"></s:select>
		</td>
	</tr>
	<tr>
		<td class="coln"><SPAN style="color: red">*</SPAN> 驾驶员</td>
		<td width="35%" class="colv">
			<s:select list="drivers" listKey="driverId" listValue="name"  name="driverId" cssStyle="width:80%"></s:select>
		</td>
		<td class="coln"><SPAN style="color: red">*</SPAN> 加油日期</td>
		<td width="45%" class="colv">
			 <s:textfield onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"  cssClass="Wdate" name="petrolDate"></s:textfield>
		</td>
	</tr>
	<tr>
		<td class="coln">加油站</td>
		<td width="35%" class="colv">
			<s:textfield name="petrolStation"></s:textfield>
		</td>
		<td class="coln"><SPAN style="color: red">*</SPAN> 加油类型</td>
		<td width="35%" class="colv">
			<s:select list="paramter" listKey="id.paramKey" listValue="paramValue"  name="petrolType" cssStyle="width:80%"></s:select>
		</td>
	</tr>
	<tr>
		<td class="coln"> 加油数</td>
		<td width="45%" class="colv">
			<s:textfield name="petrolQuantity"></s:textfield> 
		</td>
		<td class="coln">油单价</td>
		<td width="45%" class="colv">
			<s:textfield name="unitPrice"></s:textfield>
		</td>
	</tr>
	<tr>
		<td class="coln"> 总金额</td>
		<td width="45%" class="colv">
			<s:textfield name="totalCharge"></s:textfield> 
		</td>
		<td class="coln">备注</td>
		<td width="45%" class="colv">
			<s:textfield name="note"></s:textfield>
		</td>
	</tr>
	<tr align="right" bgcolor="#EEF4EA">
		<td height="35" colspan="4" align="center">
			<a href="javascript:history.go(-1)" class="coolbg">&nbsp;返&nbsp;回&nbsp;</a>
			<a href="#" class="coolbg" onclick="return doSumbit();">&nbsp;保&nbsp;存&nbsp;</a>
			<a href="javascript:document.forms[0].reset()" class="coolbg">&nbsp;重&nbsp;置&nbsp;</a>
		</td>
	</tr>
</table>
</s:form>
</body>
<script type="text/javascript" src="../resource/js/popup/popup.js"></script>
<script type="text/javascript" src="../resource/js/popup/commonPopup.js"></script>
</html>
